import { useUserStore } from '@/stores';
import axios from 'axios'
import { ElMessage } from 'element-plus';
const http=axios.create({
    //
    baseURL:'/api',
    timeout:10000,
})
http.interceptors.request.use(function(req){
    const useStore=useUserStore()
    if(useStore.token){
        req.headers.Authorization=useStore.token
    }
    return req;
},function (error){
    return Promise.reject(error);
});
http.interceptors.response.use(function (response){
    return response;
},function (error){
    ElMessage.error(resizeBy.data.message||'服务异常')
    return Promise.reject(error);
});
export default http